<template>
  <div id="app">
    <h2>测试题</h2>
    <subject-com v-for="(item, index) in arr" :key="index" :index="index" @sub="sub"></subject-com>
    <div>
      <flag-com v-for="(item, index) in arr" :key="index" :index="index" :arr="arr"></flag-com>
    </div>
  </div>
</template>

<script>
import SubjectCom from './components/subject-com'
import FlagCom from './components/FlagCom'
export default {
  name: 'App',
  data () {
    return {
      arr: [0, 0, 0, 0, 0]
    }
  },
  components: {
    SubjectCom, FlagCom
  },
  methods: {
    sub (i, num) {
      this.$set(this.arr, i, num)
    }
  }
}
</script>

<style>
body {
  background-color: #eee;
}

#app {
  background-color: #fff;
  width: 500px;
  margin: 50px auto;
  box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.5);
  padding: 2em;
}
</style>
